<template>
<div>
	<h3 class="base-title">主题</h3>
	<p class="base-content">Alert 组件提供了两个不同的主题：light和dark。</p>

	<div class="demo-block" :class="{'show-case-core':caseObj1.showCoreFlag}">
		<div class="demo-block-source">
			<bh-alert title="成功提示的文案" type="success"></bh-alert>
			<bh-alert title="消息提示的文案" type="info"></bh-alert>
			<bh-alert title="警告提示的文案" type="warning"></bh-alert>
			<bh-alert title="错误提示的文案" type="error"></bh-alert>
		</div>
		<div class="demo-block-core">
			<div class="demo-block-intro">通过设置effect属性来改变主题，默认为light。</div>
			<textarea class="demo-core-box" readonly="readonly" v-model="caseSourceVal" style='height: 90px;'></textarea>
		</div>
		<div class="demo-block-footer">
			<div class="demo-ms-arr" @click='toggleDemoCore(caseObj1)'>
				<span class="demo-ms-s">显示代码</span>
				<span class="demo-ms-h">隐藏代码</span>
			</div>
			<a :href="caseObj1.coreUrl" target="_blank" class="demo-online" title="前往 codepen.io 运行此示例">在线运行</a>
		</div>
	</div>
</div>
</template>

<script>
const caseSourceVal = `
<bh-alert title="成功提示的文案" type="success"></bh-alert>
<bh-alert title="消息提示的文案" type="info"></bh-alert>
<bh-alert title="警告提示的文案" type="warning"></bh-alert>
<bh-alert title="错误提示的文案" type="error"></bh-alert>
`;
export default {
	data () {
		return {
			caseObj1: {
				showCoreFlag: false,
				coreUrl: 'https://codepen.io/xiebaolin/pen/bGrNjbp',
			},
			caseSourceVal: caseSourceVal,
		};
	},
	methods: {
		// 切换代码显隐
		toggleDemoCore (item) {
			item.showCoreFlag = !item.showCoreFlag;
		}
	},
}
</script>

<style scoped>
.demo-block .bh-alert{ margin-bottom: 20px; }
</style>
